package org.vectrics.recruiter.reporting;

import org.apache.log4j.Category;
import org.vectrics.DataException;
import org.vectrics.common.reporting.ReportManager;
import org.vectrics.common.reporting.ReportServlet;
import org.vectrics.recruiter.config.RecruitConfig;


public class RecruitReportServlet extends ReportServlet {

	private static final long serialVersionUID = -7516095746973635463L;
	
	private static Category log = Category.getInstance(RecruitReportServlet.class);
    private boolean initialized = false;
	//public static String RECRUIT_DATASOURCE = "java:/VectricsDb";

    
    protected ReportManager getReportManager() throws DataException {
    	String dataSourceJndi = RecruitConfig.getRecruitInstance().getDataSourceJndi();
    	
		if (dataSourceJndi == null) {
			throw new DataException("The 'dataSourceAttribute' was not found in the reporting section of the config file");
		}
		else {
			log.info("DataSource: " + dataSourceJndi);
		}
    	return(new RecruitReportManager(dataSourceJndi));
    }

}